//@ts-ignore
import { Loading } from 'element-ui';
import {ElLoadingComponent} from "element-ui/types/loading";
let loadingInstance:ElLoadingComponent;

export const showLoading = () => {
    if (!loadingInstance) {
        loadingInstance = Loading.service({
            lock: true,
            text: 'Loading',
            background: 'rgba(0, 0, 0, 0.7)',
        });
    }
};

export const hideLoading = () => {
    if (loadingInstance) {
        loadingInstance.close();
        //@ts-ignore
        loadingInstance = null;
    }
};